package com.meeruu.sg.account.core.domain.component.lock;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;

import java.io.Serializable;

/**
 * @author: liwu
 * @version: 1.0.0
 * @email: <a href="mailto:liwu@pingpongx.com">联系作者</a>
 * @date: 2018/11/13 - 下午3:43
 */
@Data
@AllArgsConstructor
@Builder
public class BizLock implements Serializable {


    /** 业务类型 */
    private String bizType;

    /** 业务Id */
    private String bizId;

    /** 方法名称 */
    private String method;

    /** 过期时间 */
    private Integer expire;




    public String getLockKey() {
        final StringBuilder sb = new StringBuilder("");
        sb.append(bizType).append(bizId).append(method);
        return sb.toString();
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("BizLock[");
        sb.append("bizType-").append(bizType).append("&bizId-").append(bizId).append("&method-").append(method).append("]");
        return sb.toString();
    }


}
